<!DOCTYPE html>
<html class="car-loan">

	<head>
		<meta charset="UTF-8">
		<title>修改密码</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../Public/css/Home/mui.css" />
		<link rel="stylesheet" href="../Public/css/Home/public.css" />
		<link rel="stylesheet" href="../Public/css/Home/mui.picker.css" />
		<link rel="stylesheet" href="../Public/css/Home/mui.poppicker.css" />
		<link rel="stylesheet" href="../Public/css/Home/post-form.css" />
	</head>

	<body>
        <header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">账户密码</h1>
		</header>

		<div class="mui-content">
			<ul class="input-group">
				<li class="input-row layout-center pt10 pb10">
					<label>旧密码</label>
					<div class="flex-item1">
						<input id="oldPwd" class="tr" type="password" placeholder="请输入当前密码" />
					</div>
				</li>
				<li class="input-row layout-center">
					<label>新密码</label>
					<div class="flex-item1">
						<input id="newPwd" class="tr" type="password"  placeholder="请输入新密码"/>
					</div>
                </li>
                <li class="input-row layout-center">
					<label>确认新密码</label>
					<div class="flex-item1">
						<input id="newPwdRepeat" class="tr" type="password"  placeholder="请再输一次新密码"/>
					</div>
				</li>
				
			</ul>
		</div>

		<div class="car-foot">
			<div class="btn">
				<button id="sendBtn" class="mui-btn mui-btn-block send-btn" type="button">确认并提交</button>
			</div>
		</div>
	</body>
	<script src="../Public/js/Home/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../Public/js/Home/mui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../Public/js/Home/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="../Public/js/Home/mui.picker.js"></script>
	<script src="../Public/js/Home/mui.poppicker.js"></script>
	<script>

		var userInfo,type = 3;
                
        $(function(){
            userInfo = JSON.parse(common.getLocVal('userData'));
            console.log(userInfo.integral);
        })
		document.getElementById("sendBtn").addEventListener('tap', function() {
			var oldPwd = document.getElementById('oldPwd').value;
			if(!oldPwd) {
				common.alert("提示", "请输入当前账户密码!");
				return false;
			}
			
			var newPwd = document.getElementById("newPwd").value;
			if(!newPwd) {
				common.alert("提示", "请输入你的新密码!");
				return false;
			}
            var newPwdRepeat = document.getElementById("newPwdRepeat").value;
            if(newPwdRepeat !== newPwd){
                common.alert("提示", "确认密码和新密码不一样，请重新设置!");
				return false;
            }
			var params = {
				url: 'Personal/modifyPwd',
				data: {
                    user_id : common.getLocVal("userId"),
					old_pwd: oldPwd,
					pwd: newPwd
				}
			}
			//common.loading("正在提交...请稍后...");
			common.JsonPost(params, function(data) {
                //common.closeLoading();
                if(data){
                    common.alert("提示", data, function(){
                                    //返回个人中心
                                    mui.openWindow({
                                            url: "/m/my.html",
                                            id: "my"
                                    })
                                });   
                        
                }
                 
                                
			});
        });
	</script>

</html>